import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import java.io.IOException;

public class StepTwo {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = HBaseConfiguration.create();
        Path path = new Path("./tmp_1");
        Job job = Job.getInstance(conf);
        job.setJarByClass(StepOne.class);
        job.setJobName("倒排索引step2");
        job.setMapperClass(YourMapper.class);
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        job.setCombinerClass(YourCombiner.class);

        FileInputFormat.setInputPaths(job, path);
        FileInputFormat.setInputDirRecursive(job, true);
        TableMapReduceUtil.initTableReducerJob("InvertedIndex", YourReducer.class, job);
        System.out.println(job.waitForCompletion(true));
    }
}
